import Notipy 
import sys
import os

class NotipySync(Notipy.Notipy):
    
    def __init__(self,dir,todir):
        self._todir = todir
        print self._todir
        Notipy.Notipy.__init__(self,dir)

    
    def event_file_new(self,path):
        if not os.path.isdir(self._todir + "/" + os.path.dirname(path)):
            os.makedirs(self._todir + "/" + os.path.dirname(path))
        f_in = open(path,'r')
        f_out = open(self._todir + "/" + path,'w')
        f_out.write(f_in.read())
        f_in.close()
        f_out.close()
    


if __name__ == "__main__":
    if len(sys.argv) > 1:
        dir = sys.argv[1]
        todir = sys.argv[2]
    else:
        dir = "/tmp/a"
        todir = "/tmp/b"
            
    n = NotipySync(dir,todir)

